package org.hhchat.others.tercent.p2018;

import java.util.Scanner;


public class P3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            count = 0;
            k = scanner.nextInt();
            a = scanner.nextInt();
            x = scanner.nextInt();
            b = scanner.nextInt();
            y = scanner.nextInt();
            addMusic(k, 0);
            System.out.println(count);
        }

    }

    static int count;
    static int k,x,a,y,b;


    public static void addMusic(int remain, int index){
        if (remain == 0){
            count += 1;
            return;
        }

        if (remain < 0) {
            return;
        }

        int curLength;
        if (index < x){
            curLength = a;
        } else if (index < x + y) {
            curLength = b;
        } else {
            return;
        }
        addMusic(remain - curLength, index + 1);
        addMusic(remain, index + 1);

    }
}
